const fs = require("fs")
module.exports =  {
    responseHtml,
    responseJSON
}
function responseHtml(name, response, param) {
    fs.readFile(name, function (err, data) {
        if (err) {
            console.log(err);
            response.writeHead(404, {'Content-Type': 'text/html'});
        } else {
            response.writeHead(200, {'Content-Type': 'text/html'});
            response.write(data.toString());
        }
    });
}

function responseJSON(response, param) {
    response.writeHead(200, {'Content-Type': 'application/json'});
    response.write(param);
}
